/*
 *  lyf - Conway's Game of Life in C++
 *  Copyright (C) 2006-2008 Antoine Kalmbach
 *
 *  This program is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation, either version 3 of the License, or
 *  (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 ***/

#include "grid.h"
#include "board.h"
#include "ruleset.h"

#include <iostream>
#include <fstream>
#include <string>
#include <stdexcept>

int main(int argc, char *argv[])
{
    Life::Board board;
    char c;
    Life::Ruleset<2, 3, 3> ruleset;

    try
    {
        board.load("lwss.txt");
        board.print(std::cout);
        std::cin.get();
        while ((c = std::cin.get()) != 'q')
        {
            Life::Board::Stats s = board.update(ruleset);
            board.print(std::cout);
            std::cout << "Killed: " << s.killed << " Ressed: " << s.ressed << " Unchanged: " << s.unchanged << std::endl;
        }
    }
    catch (std::runtime_error &e)
    {
        std::cout << "Error: " << e.what() << std::endl;
        std::cin.get();
    }
    return 0;
}
